package com.base.conf;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * swagger配置
 * @author Administrator
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    
    @Bean
    public Docket newApi() {
        return new Docket(DocumentationType.SWAGGER_2).groupName("cjeye-service-integration")
                .select() // 选择那些路径和api会生成document
                .paths(PathSelectors.any()) // 对所有路径进行监控
                .build()
                .apiInfo(loginApiInfo());
    }
    
    /*
     * @Bean public UiConfiguration getUiConfig() { UiConfiguration conf =
     * UiConfiguration.Constants; return conf; }
     */
    private ApiInfo loginApiInfo() {
        return new ApiInfoBuilder()
                // 页面标题
                .title("一体化服务接口")
                // 版本号
                .version("1.0")
                // 描述
                .description("API 描述")
                .build();
    }
    
}
